package com.bruce.asurada.sso.client.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

/**
 * 安全配置 - 禁用Spring Security默认配置
 * 
 * @author Bruce
 */
@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
            .authorizeHttpRequests(authz -> authz
                .anyRequest().permitAll()  // 允许所有请求
            )
            .csrf(csrf -> csrf.disable())  // 禁用CSRF
            .formLogin(form -> form.disable())  // 禁用默认登录页面
            .httpBasic(basic -> basic.disable());  // 禁用HTTP Basic认证
        
        return http.build();
    }
}